#ifndef PLAYER_H
#define PLAYER_H

#include "NonCopyable.h"

#include <SFML/Config.hpp>
#include <map>

namespace sf
{
class RenderWindow;
}

class AnimatedSprite;


// TODO: Handle movement
// TODO: Handle sprite state
class Player : public NonCopyable<Player>
{
public:
    Player(sf::Int32 x, sf::Int32 y);
    ~Player();

    void StartMovingLeft();
    void StartMovingRight();
    void StartMovingUp();
    void StartMovingDown();
    void StopMoving();

    void Update(sf::Int32 deltaTime);
    void Render(sf::RenderWindow& window);

private:
    void initializeSprites();
    void getRidOfSprites();
 
private:

    enum EAction
    {
        STANDING = 0,
        MOVING
    };

    enum EFacing
    {
        DOWN = 0,
        LEFT,
        RIGHT,
        UP
    };

    struct SpriteState
    {
        SpriteState() : m_action(STANDING), m_facing(DOWN) {}
        SpriteState(EAction action, EFacing facing) : m_action(action), m_facing(facing) {}

        EAction m_action;
        EFacing m_facing;
    };
    friend bool operator<(SpriteState left, SpriteState right);

    SpriteState m_spriteState;

    SpriteState getSpriteState() const;

    sf::Int32 m_x, m_y;
    EFacing m_horizontalFacing;

    typedef std::map<SpriteState, AnimatedSprite*> TSprites;
    TSprites m_sprites;

    // TODO: Movement here

};

#endif // PLAYER_H
